```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>中介者设计模式：协调对象间的通信</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e45e2 0%, #89d4cf 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .code-block {
            font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
            background-color: #2d2d2d;
            color: #f8f8f2;
            border-radius: 0.5rem;
            overflow-x: auto;
        }
        .code-keyword {
            color: #f92672;
        }
        .code-class {
            color: #66d9ef;
        }
        .code-string {
            color: #e6db74;
        }
        .code-comment {
            color: #75715e;
        }
        .drop-cap::first-letter {
            font-size: 4rem;
            font-weight: bold;
            float: left;
            line-height: 1;
            margin-right: 1rem;
            color: #6e45e2;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <div class="inline-block mb-6 px-4 py-2 bg-white bg-opacity-20 rounded-full backdrop-filter backdrop-blur-sm">
                <span class="font-bold">设计模式系列</span>
            </div>
            <h1 class="text-4xl md:text-6xl font-bold mb-6">中介者设计模式</h1>
            <p class="text-xl md:text-2xl max-w-3xl mx-auto mb-8 opacity-90">协调对象间的通信，降低系统耦合度</p>
            <div class="flex justify-center space-x-4">
                <a href="#intro" class="px-6 py-3 bg-white text-indigo-700 font-semibold rounded-full hover:bg-opacity-90 transition-all">
                    开始探索 <i class="fas fa-arrow-down ml-2"></i>
                </a>
                <a href="#example" class="px-6 py-3 bg-transparent border-2 border-white text-white font-semibold rounded-full hover:bg-white hover:bg-opacity-10 transition-all">
                    查看示例 <i class="fas fa-code ml-2"></i>
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-16">
        <!-- Introduction -->
        <section id="intro" class="mb-20">
            <div class="drop-cap text-gray-700 text-lg leading-relaxed">
                中介者设计模式是一种行为型设计模式，旨在通过将对象之间的通信集中到一个中介者对象中，以减少对象间的耦合度，提高系统的可维护性和可扩展性。
            </div>
            
            <!-- Visualization -->
            <div class="my-12 p-6 bg-white rounded-xl shadow-lg">
                <h2 class="text-2xl font-bold mb-6 text-indigo-700 flex items-center">
                    <i class="fas fa-project-diagram mr-3"></i>
                    中介者模式结构图
                </h2>
                <div class="mermaid">
                    classDiagram
                    class Mediator {
                        <<interface>>
                        +sendMessage()
                    }
                    class ConcreteMediator {
                        -colleagues: List
                        +sendMessage()
                    }
                    class Colleague {
                        -mediator: Mediator
                        +sendMessage()
                        +receiveMessage()
                    }
                    class ConcreteColleague1
                    class ConcreteColleague2
                    
                    Mediator <|-- ConcreteMediator
                    Colleague <|-- ConcreteColleague1
                    Colleague <|-- ConcreteColleague2
                    Colleague --> Mediator
                    ConcreteMediator --> Colleague
                </div>
            </div>
        </section>

        <!-- Features -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b-2 border-indigo-200 pb-2 flex items-center">
                <i class="fas fa-star mr-3 text-indigo-500"></i>
                核心特点
            </h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-indigo-100 p-3 rounded-full mr-4">
                            <i class="fas fa-unlink text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">解耦对象间关系</h3>
                    </div>
                    <p class="text-gray-600">中介者模式将对象间的通信逻辑封装在中介者对象中，从而将对象间的关系解耦，减少彼此的直接依赖。</p>
                </div>
                
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-indigo-100 p-3 rounded-full mr-4">
                            <i class="fas fa-network-wired text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">集中控制</h3>
                    </div>
                    <p class="text-gray-600">所有的通信逻辑都由中介者进行控制，避免了逻辑分散在各个对象之间。</p>
                </div>
                
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-indigo-100 p-3 rounded-full mr-4">
                            <i class="fas fa-project-diagram text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">复杂性降低</h3>
                    </div>
                    <p class="text-gray-600">中介者模式将复杂的交互逻辑从各个对象中分离出来，使得对象更加专注于自身的功能。</p>
                </div>
                
                <div class="bg-white p-6 rounded-xl shadow-md card-hover">
                    <div class="flex items-center mb-4">
                        <div class="bg-indigo-100 p-3 rounded-full mr-4">
                            <i class="fas fa-exchange-alt text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">通信简化</h3>
                    </div>
                    <p class="text-gray-600">一对多的通信关系简化为对象与中介者的一对一关系，系统结构更清晰。</p>
                </div>
            </div>
        </section>

        <!-- Use Cases -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b-2 border-indigo-200 pb-2 flex items-center">
                <i class="fas fa-lightbulb mr-3 text-yellow-500"></i>
                适用场景
            </h2>
            
            <div class="grid md:grid-cols-2 gap-6">
                <div class="flex items-start">
                    <div class="bg-indigo-100 p-2 rounded-full mr-4 mt-1">
                        <i class="fas fa-code-branch text-indigo-600"></i>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold mb-2 text-gray-800">对象间耦合复杂</h3>
                        <p class="text-gray-600">当系统中多个对象之间的通信关系复杂且难以维护时，可以考虑使用中介者模式来简化交互。</p>
                    </div>
                </div>
                
                <div class="flex items-start">
                    <div class="bg-indigo-100 p-2 rounded-full mr-4 mt-1">
                        <i class="fas fa-comments text-indigo-600"></i>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold mb-2 text-gray-800">一对多通信</h3>
                        <p class="text-gray-600">当多个对象需要与一组其他对象通信时，可以使用中介者模式来集中管理这种通信。</p>
                    </div>
                </div>
            </div>
            
            <div class="mt-12 bg-blue-50 p-6 rounded-xl">
                <h3 class="text-xl font-bold mb-4 flex items-center text-blue-700">
                    <i class="fas fa-cubes mr-3"></i>
                    框架中的应用实例
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-white p-4 rounded-lg shadow-sm">
                        <h4 class="font-bold mb-2 text-blue-600">Java的AWT事件处理</h4>
                        <p class="text-gray-600">AWT中的事件处理机制使用了中介者模式，通过事件源和事件监听器来实现对象之间的通信。</p>
                    </div>
                    <div class="bg-white p-4 rounded-lg shadow-sm">
                        <h4 class="font-bold mb-2 text-blue-600">Spring框架</h4>
                        <p class="text-gray-600">Spring框架中的ApplicationContext作为一个中介者，管理各个Bean的依赖关系和通信。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Example -->
        <section id="example" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b-2 border-indigo-200 pb-2 flex items-center">
                <i class="fas fa-laptop-code mr-3 text-green-500"></i>
                实现示例
            </h2>
            
            <p class="text-gray-700 mb-6">以下是一个简单的中介者模式示例，实现了一个简单的聊天室，其中用户之间的通信由中介者来协调：</p>
            
            <div class="code-block p-6 rounded-lg mb-8">
                <pre><code>import java.util.ArrayList;
import java.util.List;

<span class="code-keyword">// 抽象中介者</span>
<span class="code-keyword">interface</span> <span class="code-class">Mediator</span> {
    <span class="code-keyword">void</span> sendMessage(<span class="code-class">User</span> user, <span class="code-class">String</span> message);
}

<span class="code-keyword">// 具体中介者</span>
<span class="code-keyword">class</span> <span class="code-class">ChatRoom</span> <span class="code-keyword">implements</span> <span class="code-class">Mediator</span> {
    <span class="code-keyword">private</span> <span class="code-class">List</span>&lt;<span class="code-class">User</span>&gt; users = <span class="code-keyword">new</span> <span class="code-class">ArrayList</span>&lt;&gt;();

    <span class="code-keyword">public</span> <span class="code-keyword">void</span> addUser(<span class="code-class">User</span> user) {
        users.add(user);
    }

    <span class="code-keyword">public</span> <span class="code-keyword">void</span> sendMessage(<span class="code-class">User</span> user, <span class="code-class">String</span> message) {
        <span class="code-keyword">for</span> (<span class="code-class">User</span> u : users) {
            <span class="code-keyword">if</span> (u != user) {
                u.receiveMessage(message);
            }
        }
    }
}

<span class="code-keyword">// 抽象同事类</span>
<span class="code-keyword">class</span> <span class="code-class">User</span> {
    <span class="code-keyword">protected</span> <span class="code-class">Mediator</span> mediator;
    <span class="code-keyword">protected</span> <span class="code-class">String</span> name;

    <span class="code-keyword">public</span> <span class="code-class">User</span>(<span class="code-class">Mediator</span> mediator, <span class="code-class">String</span> name) {
        <span class="code-keyword">this</span>.mediator = mediator;
        <span class="code-keyword">this</span>.name = name;
    }

    <span class="code-keyword">public</span> <span class="code-keyword">void</span> sendMessage(<span class="code-class">String</span> message) {
        mediator.sendMessage(<span class="code-keyword">this</span>, message);
    }

    <span class="code-keyword">public</span> <span class="code-keyword">void</span> receiveMessage(<span class="code-class">String</span> message) {
        <span class="code-class">System</span>.out.println(name + <span class="code-string">" 收到消息："</span> + message);
    }
}

<span class="code-keyword">public</span> <span class="code-keyword">class</span> <span class="code-class">MediatorPatternDemo</span> {
    <span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">void</span> main(<span class="code-class">String</span>[] args) {
        <span class="code-class">ChatRoom</span> chatRoom = <span class="code-keyword">new</span> <span class="code-class">ChatRoom</span>();

        <span class="code-class">User</span> user1 = <span class="code-keyword">new</span> <span class="code-class">User</span>(chatRoom, <span class="code-string">"Alice"</span>);
        <span class="code-class">User</span> user2 = <span class="code-keyword">new</span> <span class="code-class">User</span>(chatRoom, <span class="code-string">"Bob"</span>);
        <span class="code-class">User</span> user3 = <span class="code-keyword">new</span> <span class="code-class">User</span>(chatRoom, <span class="code-string">"Charlie"</span>);

        chatRoom.addUser(user1);
        chatRoom.addUser(user2);
        chatRoom.addUser(user3);

        user1.sendMessage(<span class="code-string">"Hello, everyone!"</span>);
    }
}</code></pre>
            </div>
            
            <div class="bg-indigo-50 p-6 rounded-xl">
                <h3 class="text-xl font-bold mb-4 flex items-center text-indigo-700">
                    <i class="fas fa-chalkboard-teacher mr-3"></i>
                    代码解析
                </h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-bold mb-2 text-indigo-600">1. Mediator 接口</h4>
                        <p class="text-gray-600">定义了中介者的基本功能，主要是发送消息的方法。</p>
                    </div>
                    <div>
                        <h4 class="font-bold mb-2 text-indigo-600">2. ChatRoom 实现</h4>
                        <p class="text-gray-600">具体中介者实现，管理用户列表并处理消息广播。</p>
                    </div>
                    <div>
                        <h4 class="font-bold mb-2 text-indigo-600">3. User 类</h4>
                        <p class="text-gray-600">同事类，通过中介者与其他用户通信，而不是直接交互。</p>
                    </div>
                    <div>
                        <h4 class="font-bold mb-2 text-indigo-600">4. 演示类</h4>
                        <p class="text-gray-600">创建聊天室和用户，展示中介者模式的实际应用。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Conclusion -->
        <section class="bg-white p-8 rounded-xl shadow-lg">
            <h2 class="text-3xl font-bold mb-6 text-gray-800 flex items-center">
                <i class="fas fa-check-circle mr-3 text-green-500"></i>
                总结
            </h2>
            <div class="prose max-w-none">
                <p class="text-gray-700 mb-4">中介者设计模式通过引入中介者对象，将对象间的通信关系集中管理，从而降低对象之间的耦合度。通过将复杂的通信逻辑分离出来，可以提高系统的可维护性和可扩展性。</p>
                <p class="text-gray-700">在现实世界中，中介者模式可以帮助系统实现更松散的耦合，以及更好的代码复用。它特别适用于那些对象间交互复杂、关系紧密的场景，能够显著简化系统的设计和维护工作。</p>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-400 hover:text-white transition-colors">
                        http://www.yuque.com/jtostring
                    </a>
                </div>
                <div class="flex space-x-6">
                    <a href="#" class="text-gray-400 hover:text-white transition-colors">
                        <i class="fab fa-github text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition-colors">
                        <i class="fab fa-twitter text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition-colors">
                        <i class="fab fa-weixin text-xl"></i>
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```